package com.etoak.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

@Data
@TableName("sys_user")
public class User {

    /**
     * IdType.AUTO 主键策略根据数据库来
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField("username")
    @NotBlank(message = "name不能为空")
    @Length(min = 2, max = 10, message = "name长度为2-10个字符")
    private String name;

    private String password;

    @NotBlank(message = "email不能为空")
    @Email(message = "email格式错误")
    private String email;

    private Integer state;

    @NotNull(message = "age不能为空")
    @Range(min = 1, max = 60, message = "age在1-60之间")
    private Integer age;

    private Integer money;

    private String createTime;
}
